<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>测试报告</title>
    <meta name="generator" content="HTMLTestRunner 0.8.2"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <style type="text/css" media="screen">
        body {
            font-family: verdana, arial, helvetica, sans-serif;
            font-size: 80%;
        }

        table {
            font-size: 100%;
        }

        pre {
        }

        /* -- heading ---------------------------------------------------------------------- */
        h1 {
            font-size: 16pt;
            color: gray;
        }

        .heading {
            margin-top: 0ex;
            margin-bottom: 1ex;
        }

        .heading .attribute {
            margin-top: 1ex;
            margin-bottom: 0;
        }

        .heading .description {
            margin-top: 4ex;
            margin-bottom: 6ex;
        }

        /* -- css div popup ------------------------------------------------------------------------ */
        a.popup_link {
        }

        a.popup_link:hover {
            color: red;
        }

        .img {
            width: 100%;
            height: 100%;
            border-collapse: collapse;
            border: 2px solid #777;
        }

        .screenshots {
            z-index: 100;
            position: absolute;
            left: 23%;
            top: 20%;
            display: none;
        }

        .close_shots {
            position: absolute;
            top: 0;
            left: 98%;
            z-index: 99;
            width: 20px;
        }

        .popup_window {
            display: none;
            position: relative;
            left: 0px;
            top: 0px;
            /*border: solid #627173 1px; */
            padding: 10px;
            background-color: #E6E6D6;
            font-family: "Lucida Console", "Courier New", Courier, monospace;
            text-align: left;
            font-size: 8pt;
            width: 800px;
        }

        }
        /* -- report ------------------------------------------------------------------------ */
        #show_detail_line {
            margin-top: 3ex;
            margin-bottom: 1ex;
        }

        #result_table {
            width: 80%;
            border-collapse: collapse;
            border: 1px solid #777;
        }

        #header_row {
            font-weight: bold;
            color: white;
            background-color: #777;
        }

        #result_table td {
            border: 1px solid #777;
            padding: 2px;
        }

        #total_row {
            font-weight: bold;
        }

        .passClass {
            background-color: #6c6;
        }

        .failClass {
            background-color: #c60;
        }

        .errorClass {
            background-color: #c00;
        }

        .passCase {
            color: #6c6;
            font-weight: bold;
        }

        .failCase {
            color: #c60;
            font-weight: bold;
        }

        .errorCase {
            color: #c00;
            font-weight: bold;
        }

        .hiddenRow {
            display: none;
        }

        .testcase {
            margin-left: 2em;
        }


        /* -- ending ---------------------------------------------------------------------- */
        #ending {
        }

        .piechart {
            position: absolute;;
            top: 20px;
            left: 350px;
            width: 200px;
            float: left;
            display: inline;
        }

    </style>

</head>
<body>
<script language="javascript" type="text/javascript"><!--
output_list = Array();

/* 增加显示通过分类列表  --YinJia */
/* level - 0:Summary; 1:Failed; 2:Pass; 3:All */
function showCase(level) {
    trs = document.getElementsByTagName("tr");
    for (var i = 0; i < trs.length; i++) {
        tr = trs[i];
        id = tr.id;
        if (id.substr(0, 2) == 'ft') {
            if (level == 2 || level == 0) {
                tr.className = 'hiddenRow';
            } else {
                tr.className = '';
            }
        }
        if (id.substr(0, 2) == 'pt') {
            if (level < 2) {
                tr.className = 'hiddenRow';
            } else {
                tr.className = '';
            }
        }
    }
}


function showClassDetail(cid, count) {
    var id_list = Array(count);
    var toHide = 1;
    for (var i = 0; i < count; i++) {
        tid0 = 't' + cid.substr(1) + '.' + (i + 1);
        tid = 'f' + tid0;
        tr = document.getElementById(tid);
        if (!tr) {
            tid = 'p' + tid0;
            tr = document.getElementById(tid);
        }
        id_list[i] = tid;
        if (tr.className) {
            toHide = 0;
        }
    }
    for (var i = 0; i < count; i++) {
        tid = id_list[i];
        if (toHide) {
            document.getElementById('div_' + tid).style.display = 'none'
            document.getElementById(tid).className = 'hiddenRow';
        } else {
            document.getElementById(tid).className = '';
        }
    }
}


function showTestDetail(div_id) {
    var details_div = document.getElementById(div_id)
    var displayState = details_div.style.display
    // alert(displayState)
    if (displayState != 'block') {
        displayState = 'block'
        details_div.style.display = 'block'
    } else {
        details_div.style.display = 'none'
    }
}


function html_escape(s) {
    s = s.replace(/&/g, '&amp;');
    s = s.replace(/</g, '&lt;');
    s = s.replace(/>/g, '&gt;');
    return s;
}

/* 增加饼图显示  --YinJia */
function drawCircle(pass, fail, error) {
    var color = ["#6c6", "#c60", "#c00"];
    var data = [pass, fail, error];
    var text_arr = ["pass", "fail", "error"];

    var canvas = document.getElementById("circle");
    var ctx = canvas.getContext("2d");
    var startPoint = 0;
    var width = 20, height = 10;
    var posX = 112 * 2 + 20, posY = 30;
    var textX = posX + width + 5, textY = posY + 10;
    for (var i = 0; i < data.length; i++) {
        ctx.fillStyle = color[i];
        ctx.beginPath();
        ctx.moveTo(112, 84);
        ctx.arc(112, 84, 84, startPoint, startPoint + Math.PI * 2 * (data[i] / (data[0] + data[1] + data[2])), false);
        ctx.fill();
        startPoint += Math.PI * 2 * (data[i] / (data[0] + data[1] + data[2]));
        ctx.fillStyle = color[i];
        ctx.fillRect(posX, posY + 20 * i, width, height);
        ctx.moveTo(posX, posY + 20 * i);
        ctx.font = 'bold 14px';
        ctx.fillStyle = color[i];
        var percent = text_arr[i] + ":" + data[i];
        ctx.fillText(percent, textX, textY + 20 * i);

    }
}

function show_shots(obj) {
    obj.nextElementSibling.style.display = "block";

}

function close_shots(obj) {
    obj.parentElement.style.display = "none";
}


/* obsoleted by detail in <div>
function showOutput(id, name) {
    var w = window.open("", //url
                    name,
                    "resizable,scrollbars,status,width=800,height=450");
    d = w.document;
    d.write("<pre>");
    d.write(html_escape(output_list[id]));
    d.write("\n");
    d.write("<a href='javascript:window.close()'>close</a>\n");
    d.write("</pre>\n");
    d.close();
}
*/
--></script>
<div class="piechart">
    <div>
        <canvas id="circle" width="350" height="168"
        </canvas>
    </div>
</div>
<div class='heading'>
    <h1>测试报告</h1>
    <p class='attribute'><strong>测试人员:</strong> 最棒QA</p>
    <p class='attribute'><strong>开始时间:</strong> 2021-02-28 22:42:54</p>
    <p class='attribute'><strong>合计耗时:</strong> 0:00:17.299139</p>
    <p class='attribute'><strong>测试结果:</strong> 总共 3 通过 1 错误 2 通过率 = 33.33%</p>

    <p class='description'>Test the import testcase</p>
</div>


<p id='show_detail_line'>显示
    <a href='javascript:showCase(0)'>概要</a>
    <a href='javascript:showCase(1)'>失败[0]</a>
    <a href='javascript:showCase(2)'>通过[1]</a>
    <a href='javascript:showCase(3)'>所有[3]</a>
</p>
<table id='result_table'>
    <colgroup>
        <col align='left'/>
        <col align='right'/>
        <col align='right'/>
        <col align='right'/>
        <col align='right'/>
        <col align='right'/>
        <col align='right'/>
    </colgroup>
    <tr id='header_row'>
        <td>用例集/测试用例</td>
        <td>总计</td>
        <td>通过</td>
        <td>失败</td>
        <td>错误</td>
        <td>视图</td>
        <td>错误截图</td>
    </tr>

    <tr class='errorClass'>
        <td>unittest.loader._FailedTest</td>
        <td>2</td>
        <td>0</td>
        <td>0</td>
        <td>2</td>
        <td><a href="javascript:showClassDetail('c1',2)">详情</a></td>
        <td>&nbsp;</td>
    </tr>

    <tr id='ft1.1' class='none'>
        <td class='errorCase'>
            <div class='testcase'>test_01</div>
        </td>
        <td colspan='5' align='center'>

            <!--css div popup start-->
            <a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft1.1')">
                错误</a>

            <div id='div_ft1.1' class="popup_window">
                <div style='text-align: right; color:red;cursor:pointer'>
                    <a onfocus='this.blur();' onclick="document.getElementById('div_ft1.1').style.display = 'none' ">
                        [x]</a>
                </div>
                <pre>
            
ft1.1: ImportError: Failed to import test module: test_01
Traceback (most recent call last):
  File "D:\python\lib\unittest\loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "D:\python\lib\unittest\loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "C:\Users\买菠萝凤梨\Desktop\源代码\PO\testcase\test_01.py", line 1
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb2 in position 0: invalid start byte



            </pre>
            </div>
            <!--css div popup end-->
        </td>
        <td></td>
    </tr>

    <tr id='ft1.2' class='none'>
        <td class='errorCase'>
            <div class='testcase'>test_02</div>
        </td>
        <td colspan='5' align='center'>

            <!--css div popup start-->
            <a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft1.2')">
                错误</a>

            <div id='div_ft1.2' class="popup_window">
                <div style='text-align: right; color:red;cursor:pointer'>
                    <a onfocus='this.blur();' onclick="document.getElementById('div_ft1.2').style.display = 'none' ">
                        [x]</a>
                </div>
                <pre>
            
ft1.2: ImportError: Failed to import test module: test_02
Traceback (most recent call last):
  File "D:\python\lib\unittest\loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "D:\python\lib\unittest\loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "C:\Users\买菠萝凤梨\Desktop\源代码\PO\testcase\test_02.py", line 1
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb2 in position 0: invalid start byte



            </pre>
            </div>
            <!--css div popup end-->
        </td>
        <td></td>
    </tr>

    <tr class='passClass'>
        <td>test_po.Testdemo</td>
        <td>1</td>
        <td>1</td>
        <td>0</td>
        <td>0</td>
        <td><a href="javascript:showClassDetail('c2',1)">详情</a></td>
        <td>&nbsp;</td>
    </tr>

    <tr id='pt2.1' class='hiddenRow'>
        <td class='passCase'>
            <div class='testcase'>test_01</div>
        </td>
        <td colspan='5' align='center'>

            <!--css div popup start-->
            <a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_pt2.1')">
                通过</a>

            <div id='div_pt2.1' class="popup_window">
                <div style='text-align: right; color:red;cursor:pointer'>
                    <a onfocus='this.blur();' onclick="document.getElementById('div_pt2.1').style.display = 'none' ">
                        [x]</a>
                </div>
                <pre>
            
pt2.1: 2021-02-28 22:42:54,686 - root - INFO - chrome浏览器启动中
2021-02-28 22:43:00,550 - root - INFO - 打开http://121.196.12.97:9110/admin成功
2021-02-28 22:43:00,636 - root - INFO - 账户输入成功
2021-02-28 22:43:00,791 - root - INFO - 密码输入成功
2021-02-28 22:43:00,895 - root - INFO - 登录点击成功
2021-02-28 22:43:01,758 - root - INFO - 打开http://121.196.12.97:9110/admin/index.html#/dashboard成功
2021-02-28 22:43:01,872 - root - INFO - 点击文章tab
2021-02-28 22:43:04,809 - root - INFO - 点击写文章


            </pre>
            </div>
            <!--css div popup end-->
        </td>
        <td></td>
    </tr>

    <tr id='total_row'>
        <td>总计</td>
        <td>3</td>
        <td>1</td>
        <td>0</td>
        <td>2</td>
        <td>通过率：33.33%</td>
        <td>&nbsp;</td>
    </tr>
</table>
<script>
    drawCircle(1, 0, 2)
</script>

<div id='ending'>&nbsp;</div>

</body>
</html>
